import random


def red():
    red1 = random.randint(0, 3)
    return red1


def yellow():
    yellow1 = random.randint(0, 3)
    return yellow1


def green():
    green1 = random.randint(0, 6)
    return green1


try:
    num = int(input('输入摸球次数:'))
    temp = 0
    while True:
        a = red()
        b = yellow()
        c = green()
        if a + b + c == 8:
            temp += 1
            print("红球{0}个，黄球{1}个，绿球{2}个".format(a, b, c))
        elif temp == num:
            break
except ValueError:
    print('输入有误！！！')
